package com.atguigu.gmall.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 钟涛
 * @version 1.0
 * @description: TODO
 * @date 2021/12/21 9:42
 */
@Controller
public class LoginController {

    @GetMapping("/login.html")
    public String login(HttpServletRequest request, Model model){
        String queryString = request.getQueryString();
        if(!StringUtils.isEmpty(queryString)){
            String substring = queryString.substring(10);
            model.addAttribute("originUrl",substring);
        }else{
            model.addAttribute("originUrl","http://gmall.com");
        }
        return "login";
    }
}
